home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The PC-SIG Library 10
/
The PC-Sig Library - Shareware for the IBM PC and Compatibles (PC-SIG)(Tenth Edition Disks 1-2804)(1991).iso
/
PC_SIGCD
/
22
/
2
/
DISK2220.ZIP
/
SCREDIT2.EXE
/
SCRDEMO.C
< prev
next >
Wrap
C/C++ Source or Header
|
1991-01-05
|
27KB
|
949 lines
/*
********************************************************************
ScrDemo.C is provide to supply you with a supply of programming
examples for using Turbo ScrEdit procedures. Feel free to use any
of the procedures in this file that you wish in your programs.
To compile and run this program you must perform the following steps.
*** THE POP UP WINDOWS AND MOUSE OPTIONS WILL NOT WORK IF YOU ***
*** TRY TO RUN THEM FROM INSIDE THE TURBO C PROGRAMMING ***
*** ENVIRONMENT. EXIT TO DOS TO RUN SCRDEMO AND THEN YOU CAN ***
*** RUN THE POP UP WINDOWS AND MOUSE DEMOS. ***
First you must open a project file with the following lines
Turbo C 2.0
Create a project file that contains the following lines
ScrDemo.C
ScrEditL.Lib
Turbo C ++
Open a project file with the following lines (The names
listed below will also be changed as listed above.)
Set (P)ROJECT/(O)PEN PROJECT/(L)OAD PROJECT FILE to "ScrDemo.prj"
press (INSert) and type "ScrDemo.C"
press (INSert) and type "ScrEditC.Lib"
Set (P)ROJECT/(O)PEN PROJECT/(L)OAD PROJECT FILE to "ScrDemo.prj"
press (INSert) and type "ScrDemo.C"
press (INSert) and type "ScrEditC.Lib"
Next be sure that you..
Set COMPILER/(P)RIMARY C FILE to ScrDemo.C
Set OPTIONS/DIRECTORIES/(I)NCLUDE DIRECTORIES to include the
directory where you have stored "ScrEditC.H".
Set OPTIONS/DIRECTORIES/(L)IBRARY DIRECTORIES to include the
directory where you have stored "ScrEditC.Lib".
Set OPTIONS/COMPILER/(C)ODE GENERATION (C)OMPACT
After you performed the steps listed above this program will
compile and run if the screen file and screen buffers are in the
current directory.
********************************************************************
*/
#if defined (__TINY__) || defined (__SMALL__)
#error "This program requires COMPACT, LARGE, or HUGE memory model."
#endif
#include <stdio.h>
#include <process.h>
#include <conio.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <alloc.h>
#include <mem.h>
#include <dos.h>
#include "scredit.h"
/*
Remember to use Turbo ScrEdit to compile the screens in ScrDemo.Scr before you
try to compile and run this program. See Turbo ScrEdit Tutor for instructions.
*/
#include "SCRDEMO.001"
#include "SCRDEMO.003"
#include "SCRDEMO.005"
int Result,
Tr,Tc,Br,Bc,
Option,
Screen_Mode,
Cursor_Position;
char Name[35],
Address_a[35],
Address_b[35],
City[21],
State[3],
ZipCode[10],
Phone[15],
Ssn[12];
double Gross;
/*****************************
MENU OPTION 1 (Example data entry screen)
Section 2 of Turbo ScrEdit Tutor Describes this portion of code
*****************************/
void EnterRecords()
{
if (s_enterastab)
strcpy(Dupe_Fields_buf.Key," F10 ");
else
strcpy(Dupe_Fields_buf.Key,"Enter");
Dupe_Fields_buf.EB = s_errorbg;
Dupe_Fields_buf.EF = s_errorfg;
Dupe_Fields_buf.HB = s_helpbg;
Dupe_Fields_buf.HF = s_helpfg;
Dupe_Fields_buf.UB = s_userbg;
Dupe_Fields_buf.UF = s_userfg;
if (s_usersound)
strcpy(Dupe_Fields_buf.SO,"On");
else
strcpy(Dupe_Fields_buf.SO,"Off");
if (s_autovalidate)
strcpy(Dupe_Fields_buf.AV,"On");
else
strcpy(Dupe_Fields_buf.AV,"Off");
if (s_autohelp)
strcpy(Dupe_Fields_buf.AH,"On");
else
strcpy(Dupe_Fields_buf.AH,"Off");
if (s_clearifnotrightarrow)
strcpy(Dupe_Fields_buf.CF,"On");
else
strcpy(Dupe_Fields_buf.CF,"Off");
if (s_tabatendoffield)
strcpy(Dupe_Fields_buf.TA,"On");
else
strcpy(Dupe_Fields_buf.TA,"Off");
if (s_enterastab)
{
strcpy(Dupe_Fields_buf.Key,"F10");
strcpy(Dupe_Fields_buf.EAT,"On");
strcpy(Dupe_Fields_buf.EAF,"36");
s_enterafterfield = 36;
}
else
{
strcpy(Dupe_Fields_buf.Key,"Enter");
strcpy(Dupe_Fields_buf.EAT,"Off");
strcpy(Dupe_Fields_buf.EAF,"");
s_enterafterfield = 0;
}
s_readscreen();
if ((s_alt)&&((s_ch=='A')||(s_ch=='a')))
{
switch (s_cursor)
{
case S_OFF
: {s_cursor=S_BOLD;break;}
case S_BOLD
: {s_cursor=S_NORMAL;break;}
case S_NORMAL
: {s_cursor=S_INVERSENORMAL;break;}
case S_INVERSENORMAL
: {s_cursor=S_INVERSEBOLD;break;}
default :
s_cursor=S_OFF;
}
}
if (s_alt)
{
if ((s_f1)||(s_f2))
{
if (s_f1) s_errorbg++;
if (s_f2) s_errorfg++;
if (s_errorbg > 7) s_errorbg = 0;
if (s_errorfg > 15) s_errorfg = 0;
strcpy(s_errormsg,"Change colors of ERROR messages from VALIDATE procedures.");
}
if ((s_f3)||(s_f4))
{
if (s_f3) s_helpbg++;
if (s_f4) s_helpfg++;
if (s_helpbg > 7) s_helpbg = 0;
if (s_helpfg > 15) s_helpfg = 0;
strcpy(s_autohelpmsg,"Change Colors of HELP messages accessed by auto help or '?'");
}
if ((s_f5)||(s_f6))
{
if (s_f5) s_userbg++;
if (s_f6) s_userfg++;
if (s_userbg > 7) s_userbg = 0;
if (s_userfg > 15) s_userfg = 0;
strcpy(s_usermsg,"Specify the color attributes for you customer messages.");
}
}
if (s_ctrl)
{
if (s_f1)
{
if (s_helpsound==1)
{
s_helpsound =0;
s_errorsound=0;
s_usersound =0;
}
else
{
s_helpsound =1;
s_errorsound=1;
s_usersound =1;
}
}
if (s_f2)
s_autohelp = (s_autohelp==1)? 0:1;
if (s_f3)
s_autovalidate = (s_autovalidate==1)? 0:1;
if (s_f4)
s_enterastab = (s_enterastab==1)? 0:1;
if (s_f5)
s_tabatendoffield = (s_tabatendoffield==1)? 0:1;
if (s_f6)
s_clearifnotrightarrow = (s_clearifnotrightarrow==1)? 0:1;
}
if ((!s_alt)&&(!s_ctrl))
{
if (s_f1)
{
if (!s_isdupe(s_prevfield))
{
s_setdupe(s_prevfield-1);
s_setdupe(s_prevfield+1);
s_setdupe(s_prevfield);
if (s_isdupe(s_prevfield))
switch (s_prevfield)
{
case 12 : {strcpy(Dupe_Fields_buf.a,"[");
strcpy(Dupe_Fields_buf.r,"]");break;}
case 15 : {strcpy(Dupe_Fields_buf.b,"[");
strcpy(Dupe_Fields_buf.s,"]");break;}
case 18 : {strcpy(Dupe_Fields_buf.c,"[");
strcpy(Dupe_Fields_buf.t,"]");break;}
case 21 : {strcpy(Dupe_Fields_buf.d,"[");
strcpy(Dupe_Fields_buf.u,"]");break;}
case 24 : {strcpy(Dupe_Fields_buf.e,"[");
strcpy(Dupe_Fields_buf.v,"]");break;}
case 27 : {strcpy(Dupe_Fields_buf.f,"[");
strcpy(Dupe_Fields_buf.w,"]");break;}
case 30 : {strcpy(Dupe_Fields_buf.g,"[");
strcpy(Dupe_Fields_buf.x,"]");break;}
case 33 : {strcpy(Dupe_Fields_buf.h,"[");
strcpy(Dupe_Fields_buf.y,"]");break;}
case 36 : {strcpy(Dupe_Fields_buf.i,"[");
strcpy(Dupe_Fields_buf.z,"]");break;}
}
}
else
{
s_resetdupe(s_prevfield-1);
s_resetdupe(s_prevfield+1);
s_resetdupe(s_prevfield);
if (!s_isdupe(s_prevfield))
switch (s_prevfield)
{
case 12 : {Dupe_Fields_buf.a[0]=0;Dupe_Fields_buf.r[0]=0;break;}
case 15 : {Dupe_Fields_buf.b[0]=0;Dupe_Fields_buf.s[0]=0;break;}
case 18 : {Dupe_Fields_buf.c[0]=0;Dupe_Fields_buf.t[0]=0;break;}
case 21 : {Dupe_Fields_buf.d[0]=0;Dupe_Fields_buf.u[0]=0;break;}
case 24 : {Dupe_Fields_buf.e[0]=0;Dupe_Fields_buf.v[0]=0;break;}
case 27 : {Dupe_Fields_buf.f[0]=0;Dupe_Fields_buf.w[0]=0;break;}
case 31 : {Dupe_Fields_buf.g[0]=0;Dupe_Fields_buf.x[0]=0;break;}
case 32 : {Dupe_Fields_buf.h[0]=0;Dupe_Fields_buf.y[0]=0;break;}
case 36 : {Dupe_Fields_buf.i[0]=0;Dupe_Fields_buf.z[0]=0;break;}
}
}
}
if (s_f2)
{
s_cleardupes();
setmem(Dupe_Fields_buf.a,2,0);
setmem(Dupe_Fields_buf.b,2,0);
setmem(Dupe_Fields_buf.c,2,0);
setmem(Dupe_Fields_buf.d,2,0);
setmem(Dupe_Fields_buf.e,2,0);
setmem(Dupe_Fields_buf.f,2,0);
setmem(Dupe_Fields_buf.g,2,0);
setmem(Dupe_Fields_buf.h,2,0);
setmem(Dupe_Fields_buf.i,2,0);
setmem(Dupe_Fields_buf.r,2,0);
setmem(Dupe_Fields_buf.s,2,0);
setmem(Dupe_Fields_buf.t,2,0);
setmem(Dupe_Fields_buf.u,2,0);
setmem(Dupe_Fields_buf.v,2,0);
setmem(Dupe_Fields_buf.w,2,0);
setmem(Dupe_Fields_buf.x,2,0);
setmem(Dupe_Fields_buf.y,2,0);
setmem(Dupe_Fields_buf.z,2,0);
}
if (s_f6)
if (Dupe_Fields_buf.Name1[0]>0)
{
strcpy(Dupe_Fields_buf.Name2,Dupe_Fields_buf.Name1);
strcpy(Dupe_Fields_buf.Address2_a,Dupe_Fields_buf.Address1_a);
strcpy(Dupe_Fields_buf.Address2_b,Dupe_Fields_buf.Address1_b);
strcpy(Dupe_Fields_buf.City2,Dupe_Fields_buf.City1);
strcpy(Dupe_Fields_buf.S2,Dupe_Fields_buf.S1);
strcpy(Dupe_Fields_buf.Zip2,Dupe_Fields_buf.Zip1);
strcpy(Dupe_Fields_buf.Phone2,Dupe_Fields_buf.Phone1);
strcpy(Dupe_Fields_buf.Ssn2,Dupe_Fields_buf.Ssn1);
Dupe_Fields_buf.Gross2=Dupe_Fields_buf.Gross1;
setmem(Dupe_Fields_buf.Name1,35,0);
setmem(Dupe_Fields_buf.Address1_a,35,0);
setmem(Dupe_Fields_buf.Address1_b,35,0);
setmem(Dupe_Fields_buf.City1,21,0);
setmem(Dupe_Fields_buf.S1,3,0);
setmem(Dupe_Fields_buf.Zip1,10,0);
setmem(Dupe_Fields_buf.Phone1,15,0);
setmem(Dupe_Fields_buf.Ssn1,12,0);
Dupe_Fields_buf.Gross1 = 0;
s_point = 8;
}
else
strcpy(s_usermsg," No record entered to Edit..");
}
if ((s_enterastab)&&(s_f10))
{
s_screenvalid = 1;
s_validatescreen();
if (!s_screenvalid) s_resetkeyflags();
}
if (((!s_enterastab)&&(s_enter))||((s_enterastab)&&(s_f10)))
{
strcpy(Name,Dupe_Fields_buf.Name2);
strcpy(Address_a,Dupe_Fields_buf.Address2_a);
strcpy(Address_b,Dupe_Fields_buf.Address2_b);
strcpy(City,Dupe_Fields_buf.City2);
strcpy(State,Dupe_Fields_buf.S2);
strcpy(ZipCode,Dupe_Fields_buf.Zip2);
strcpy(Phone,Dupe_Fields_buf.Phone2);
strcpy(Ssn,Dupe_Fields_buf.Ssn2);
Gross=Dupe_Fields_buf.Gross2;
s_clearscreen(1);
strcpy(Dupe_Fields_buf.Name1,Name);
strcpy(Dupe_Fields_buf.Address1_a,Address_a);
strcpy(Dupe_Fields_buf.Address1_b,Address_b);
strcpy(Dupe_Fields_buf.City1,City);
strcpy(Dupe_Fields_buf.S1,State);
strcpy(Dupe_Fields_buf.Zip1,ZipCode);
strcpy(Dupe_Fields_buf.Phone1,Phone);
strcpy(Dupe_Fields_buf.Ssn1,Ssn);
Dupe_Fields_buf.Gross1=Gross;
s_point = 8;
}
}
void RecordDemo()
{
Name[0] =0;
Address_a[0] =0;
Address_b[0] =0;
City[0] =0;
State[0] =0;
ZipCode[0] =0;
Phone[0] =0;
Ssn[0] =0;
Gross =0;
s_point = -1;
s_enterastab = 0;
s_clearifnotrightarrow = 0;
s_autohelp = 0;
s_autovalidate = 0;
s_enterafterfield = 0;
s_loadscreen("Dupe_Fields");
s_clearscreen(1);
while (!s_esc)
{
EnterRecords();
}
s_clearifnotrightarrow = 0;
s_tabatendoffield = 0;
s_enterastab = 0;
s_autohelp = 0;
s_autovalidate = 0;
s_errorsound = 1;
s_helpsound = 1;
s_usersound = 1;
s_setdisplayoff(1);
s_cursor = S_NORMAL;
}
/*****************************
MENU OPTION 3 (Customizing Screen Colors)
Section 4 of Turbo ScrEdit Tutor Describes this portion of code
*****************************/
void ChangeColors()
{
int X,Y;
Color_Demo_buf.F1=2.0;
Color_Demo_buf.A =0.0;
Color_Demo_buf.F2=0.0;
Color_Demo_buf.B =5.0;
Color_Demo_buf.F3=15.0;
Color_Demo_buf.C =0.0;
Color_Demo_buf.F4=14.0;
Color_Demo_buf.D =0.0;
Color_Demo_buf.F5=3.0;
Color_Demo_buf.E =0;
Color_Demo_buf.F6=2.0;
Color_Demo_buf.F =0.0;
Color_Demo_buf.F7=2.0;
Color_Demo_buf.G =0.0;
Color_Demo_buf.F8=15.0;
Color_Demo_buf.H =0.0;
Color_Demo_buf.F9=2.0;
Color_Demo_buf.I =0.0;
while (!s_esc)
{
s_readscreen();
/* Text */
s_changescreencolor(
0,(int)Color_Demo_buf.A,(int)Color_Demo_buf.F1, 1,24, 1,80);
/* double line around logo */
s_changescreencolor(
2,(int)Color_Demo_buf.D,(int)Color_Demo_buf.F4, 1,11, 1,80);
/* Logo */
s_changescreencolor(
2,(int)Color_Demo_buf.B,(int)Color_Demo_buf.F2, 2, 9,10,69);
/* Fill in logo letters */
s_changescreencolor(
0,(int)Color_Demo_buf.B,(int)Color_Demo_buf.F2, 2, 8,11,11);
s_changescreencolor(
0,(int)Color_Demo_buf.B,(int)Color_Demo_buf.F2, 2, 8,18,18);
s_changescreencolor(
0,(int)Color_Demo_buf.B,(int)Color_Demo_buf.F2, 5, 8,22,22);
s_changescreencolor(
0,(int)Color_Demo_buf.B,(int)Color_Demo_buf.F2, 5, 8,27,27);
s_changescreencolor(
0,(int)Color_Demo_buf.B,(int)Color_Demo_buf.F2, 5, 8,31,31);
s_changescreencolor(
0,(int)Color_Demo_buf.B,(int)Color_Demo_buf.F2, 7, 8,35,35);
s_changescreencolor(
0,(int)Color_Demo_buf.B,(int)Color_Demo_buf.F2, 5, 6,36,36);
s_changescreencolor(
0,(int)Color_Demo_buf.B,(int)Color_Demo_buf.F2, 2, 8,40,40);
s_changescreencolor(
0,(int)Color_Demo_buf.B,(int)Color_Demo_buf.F2, 3, 3,47,47);
s_changescreencolor(
0,(int)Color_Demo_buf.B,(int)Color_Demo_buf.F2, 8, 8,47,47);
s_changescreencolor(
0,(int)Color_Demo_buf.B,(int)Color_Demo_buf.F2, 5, 8,51,51);
s_changescreencolor(
0,(int)Color_Demo_buf.B,(int)Color_Demo_buf.F2, 2, 8,56,56);
s_changescreencolor(
0,(int)Color_Demo_buf.B,(int)Color_Demo_buf.F2, 6, 8,60,60);
s_changescreencolor(
0,(int)Color_Demo_buf.B,(int)Color_Demo_buf.F2, 2, 8,64,64);
/* other logo text */
s_changescreencolor(
0,(int)Color_Demo_buf.B,(int)Color_Demo_buf.F2, 6, 6, 3, 7);
s_changescreencolor(
0,(int)Color_Demo_buf.B,(int)Color_Demo_buf.F2, 2, 2,21,24);
s_changescreencolor(
0,(int)Color_Demo_buf.B,(int)Color_Demo_buf.F2, 5, 5,67,78);
s_changescreencolor(
0,(int)Color_Demo_buf.B,(int)Color_Demo_buf.F2, 6, 6,69,76);
s_changescreencolor(
0,(int)Color_Demo_buf.B,(int)Color_Demo_buf.F2, 7, 7,70,74);
s_changescreencolor(
0,(int)Color_Demo_buf.B,(int)Color_Demo_buf.F2, 8, 9,67,79);
/* Copyright Notice */
s_changescreencolor(
0,(int)Color_Demo_buf.C,(int)Color_Demo_buf.F3,10,10,27,57);
/* Version Number */
s_changescreencolor(
0,(int)Color_Demo_buf.E,(int)Color_Demo_buf.F5, 3, 3,71,75);
/* text in configure box */
s_changescreencolor(
0,(int)Color_Demo_buf.G,(int)Color_Demo_buf.F7,13,23,18,64);
/* single line box */
s_changescreencolor(
1,(int)Color_Demo_buf.F,(int)Color_Demo_buf.F6,13,24,17,65);
X = 0;
while (X < 18)
{
s_changefieldcolor(
X,1,(int)Color_Demo_buf.H,(int)Color_Demo_buf.F8);
s_changefieldcolor(
X,2,(int)Color_Demo_buf.I,(int)Color_Demo_buf.F9);
X++;
}
s_refreshscreen();
}
}
/*****************************
MENU OPTION 9 (Mixed ScrEdit)
Section 4 of Turbo ScrEdit Tutor Describes this portion of code
*****************************/
void Back_To_Turbo_C_Land()
{
char Response[11];
Response[0] = 0;
textbackground(BLACK);
textcolor (YELLOW);
while (strcmp("RETURN",Response)!= 0)
{
clrscr();
cprintf("This is regular 'C' code now.\r\n\r\n");
cprintf("You can do anything now that you want to, use any \r\n");
cprintf("programming statement that you wish to. When you \r\n");
cprintf("are ready to resume with Turbo ScrEdit just return \r\n");
cprintf("and the screen will be reloaded and you will resume \r\n");
cprintf("at the point where you left the screen.\r\n\r\n");
cprintf("Type 'RETURN' in upper case to end this example...");
Response[0]=6;
cscanf("%s",Response);
}
textbackground(BLACK);
textcolor (GREEN);
}
/*****************************
START OF MAIN MENU SCREEN PROCEDURES
Section 1 of Turbo ScrEdit Tutor Describes this portion of code
*****************************/
void ProcessScreen()
{
char WorkStr[81],
AlphaStr[81],
NumStr[81];
unsigned char Switch;
clrscr();
strcpy(WorkStr,"The procedure S_DisplayField can be used to display any value any where");
s_displayscreenfield(4,1,9,80,strlen(WorkStr),LIGHTGRAY,BLACK,0,0,WorkStr);
strcpy(WorkStr,"on the screen. Alpha fields are displayed like these messages while numeric");
s_displayscreenfield(5,1,9,80,strlen(WorkStr),LIGHTGRAY,BLACK,0,0,WorkStr);
strcpy(WorkStr,"values are displayed right justified like:");
s_displayscreenfield(6,1,9,42,strlen(WorkStr),LIGHTGRAY,BLACK,0,0,WorkStr);
strcpy(WorkStr,"1");
s_displayscreenfield(6,43,0,10,strlen(WorkStr),LIGHTGRAY,BLACK,0,0,WorkStr);
strcpy(WorkStr,"2.1");
s_displayscreenfield(7,43,2,10,strlen(WorkStr),LIGHTGRAY,BLACK,0,0,WorkStr);
strcpy(WorkStr,"3.12");
s_displayscreenfield(8,43,3,10,strlen(WorkStr),LIGHTGRAY,BLACK,0,0,WorkStr);
strcpy(WorkStr,"4.123");
s_displayscreenfield(9,43,4,10,strlen(WorkStr),LIGHTGRAY,BLACK,0,0,WorkStr);
strcpy(WorkStr,"5.1234");
s_displayscreenfield(10,43,5,10,strlen(WorkStr),LIGHTGRAY,BLACK,0,0,WorkStr);
strcpy(WorkStr,"Likewise, S_EditString can be used to open a data entry field any where on");
s_displayscreenfield(21,1,9,80,strlen(WorkStr),YELLOW,BLACK,0,0,WorkStr);
strcpy(WorkStr,"the screen. All of Turbo ScrEdit`s field editing features including help");
s_displayscreenfield(22,1,9,80,strlen(WorkStr),YELLOW,BLACK,0,0,WorkStr);
strcpy(WorkStr,"messages and edit masks can be used with these fields.");
s_displayscreenfield(23,1,9,80,strlen(WorkStr),YELLOW,BLACK,0,0,WorkStr);
strcpy(WorkStr,"<ESC> return to menu or type Alpha: Numeric:");
s_displayscreenfield(24,1,9,80,strlen(WorkStr),YELLOW,BLACK,0,0,WorkStr);
AlphaStr[0]=0;
NumStr[0] =0;
Switch =0;
s_usermask[0]= 0;
while (!s_esc)
{
if (!Switch)
{
strcpy(s_usermask,"($$$)-(33)");
strcpy(s_userhelp,"This demostrates a free form alpha numeric field entry.");
s_tabatendoffield = 1;
s_editstring(24,37,9,10,BLACK,LIGHTGRAY,YELLOW,BLACK,WHITE,BLUE,AlphaStr);
s_tabatendoffield = 0;
if ((s_tab)||(s_enter))
Switch = 1;
}
if (Switch)
{
strcpy(s_usermask,"User Mask are ignored on numeric fields");
strcpy(s_userhelp,"This demonstrates a free from numeric field with two decimal places.");
s_editstring(24,59,3,10,BLACK,LIGHTGRAY,YELLOW,BLACK,WHITE,BLUE,NumStr);
if ((s_tab)||(s_enter))
Switch = 0;
}
}
s_usermsg[0] = 0;
s_userhelp[0] = 0;
s_tabatendoffield = 0;
}
void ScrDemo_Init()
{
s_openscreenfile("ScrDemo.SCR");
initialize_Demo_Menu_buf();
initialize_Dupe_Fields_buf();
textbackground(BLACK);
textcolor (GREEN);
s_errorsound = 1;
s_errorfreq = 300;
s_errordur = 100;
s_helpsound = 1;
s_helpfreq = 400;
s_helpdur = 100;
s_usersound = 1;
s_userfreq = 200;
s_userdur = 100;
if (s_mono)
{
s_errorbg = 7;
s_errorfg = 0;
s_helpbg = 0;
s_helpfg = 1;
s_userbg = 1;
s_userbg = 0;
}
s_cursor = S_NORMAL;/* other options S_BLOCK, S_OFF */
s_sound = 0;
s_showstatus = 1;
}
void Read_Menu_Screen()
{
int PrevOption, X,Y,Z;
Option = 1;
s_loadscreen("Demo_Menu");
strcpy(Demo_Menu_buf.O1, "Example Data Entry Screen");
strcpy(Demo_Menu_buf.O2, "Demo of Mouse functions");
strcpy(Demo_Menu_buf.O3, "Customizing screen colors.");
strcpy(Demo_Menu_buf.O4, "Free form display/data entry");
strcpy(Demo_Menu_buf.O5, "Using S_ReadKey");
strcpy(Demo_Menu_buf.O6, "Using S_NextKey");
strcpy(Demo_Menu_buf.O7, "'Pop Up' windows demo");
strcpy(Demo_Menu_buf.O8, "Mixed ScrEdit");
strcpy(Demo_Menu_buf.B1, "Entry");
strcpy(Demo_Menu_buf.B2, "Mouse");
strcpy(Demo_Menu_buf.B3, "Colors");
strcpy(Demo_Menu_buf.B4, "Free form");
strcpy(Demo_Menu_buf.B5, "ReadKey");
strcpy(Demo_Menu_buf.B6, "NextKey");
strcpy(Demo_Menu_buf.B7, "Windows");
strcpy(Demo_Menu_buf.B8, "StandardIO");
strcpy(Demo_Menu_buf.P1,"1");
strcpy(Demo_Menu_buf.P2,"2");
strcpy(Demo_Menu_buf.P3,"3");
strcpy(Demo_Menu_buf.P4,"4");
strcpy(Demo_Menu_buf.P5,"5");
strcpy(Demo_Menu_buf.P6,"6");
strcpy(Demo_Menu_buf.P7,"7");
strcpy(Demo_Menu_buf.P8,"8");
PrevOption = 9;
do
{
if (s_down) Option++;
if (s_up) Option--;
if (Option < 1) Option = 8;
if (Option > 8) Option = 1;
switch (Option)
{
case 1 : {
strcpy(Demo_Menu_buf.M1,"This option is a pratical example of a");
strcpy(Demo_Menu_buf.M2,"data entry screen that demonstrates how");
strcpy(Demo_Menu_buf.M3,"to use EDIT MASKS, DUPE FIELDS, AUTO");
strcpy(Demo_Menu_buf.M4,"HELP, AUTO VALIDATE, SOUND ON/OFF,");
strcpy(Demo_Menu_buf.M5,"CLEAR SCREEN, CLEAR DUPES, and CHANGING");
strcpy(Demo_Menu_buf.M6,"MESSAGE LINE COLORS.");
PrevOption = 9;
break;
}
case 2 : {
strcpy(Demo_Menu_buf.M1,"Using the MOUSE interface. This option ");
strcpy(Demo_Menu_buf.M2,"shows how to set up and use all the ");
strcpy(Demo_Menu_buf.M3,"features of the MOUSE and MOUSE DRIVER.");
strcpy(Demo_Menu_buf.M4,"How to monitor for mouse buttons being");
strcpy(Demo_Menu_buf.M5,"pressed or mouse movement. How to");
strcpy(Demo_Menu_buf.M6,"define mouse windows, and much more..");
PrevOption = 11;
break;
}
case 3 : {
strcpy(Demo_Menu_buf.M1,"This option demonstrates how to change");
strcpy(Demo_Menu_buf.M2,"the color assignments for screens, and");
strcpy(Demo_Menu_buf.M3,"screen fields 'on the fly.' With these");
strcpy(Demo_Menu_buf.M4,"procedures you can write routines that");
strcpy(Demo_Menu_buf.M5,"will make your applications custom-");
strcpy(Demo_Menu_buf.M6,"zable to the users taste. ");
PrevOption = 14;
break;
}
case 4 : {
strcpy(Demo_Menu_buf.M1,"This option demonstrates how to use ");
strcpy(Demo_Menu_buf.M2,"S_DisplayField and S_EditString to ");
strcpy(Demo_Menu_buf.M3,"open a field any where on the screen ");
strcpy(Demo_Menu_buf.M4,"and display data to it or accept a ");
strcpy(Demo_Menu_buf.M5,"value from keyed in from the keyboard. ");
strcpy(Demo_Menu_buf.M6,"");
PrevOption = 17;
break;
}
case 5 : {
strcpy(Demo_Menu_buf.M1,"This option demonstates how a program");
strcpy(Demo_Menu_buf.M2,"can communicate with the user using the");
strcpy(Demo_Menu_buf.M3,"message line to display a messsage and");
strcpy(Demo_Menu_buf.M4,"wait for the user to respond by pressing");
strcpy(Demo_Menu_buf.M5,"a key. The key pressed is not echoed to");
strcpy(Demo_Menu_buf.M6,"the screen. See S_READKEY for more info");
PrevOption = 20;
break;
}
case 6 : {
strcpy(Demo_Menu_buf.M1,"This option demonstrates how S_NEXTKEY");
strcpy(Demo_Menu_buf.M2,"works. It is similar to S_READKEY");
strcpy(Demo_Menu_buf.M3,"except no message or screen fields are ");
strcpy(Demo_Menu_buf.M4,"displayed. Only the next key pressed is");
strcpy(Demo_Menu_buf.M5,"returned to your program.");
PrevOption = 23;
break;
}
case 7 : {
strcpy(Demo_Menu_buf.M1,"Demonstrates iHn System's 'POP UP'");
strcpy(Demo_Menu_buf.M2,"windows package that is included with");
strcpy(Demo_Menu_buf.M3,"the registered version of Turbo ScrEdit");
strcpy(Demo_Menu_buf.M4,"");
strcpy(Demo_Menu_buf.M5,"");
strcpy(Demo_Menu_buf.M6,"");
PrevOption = 26;
break;
}
case 8 : {
strcpy(Demo_Menu_buf.M1,"This demonstrates how you can exit a");
strcpy(Demo_Menu_buf.M2,"procedure using a Turbo ScrEdit screen");
strcpy(Demo_Menu_buf.M3,"to use your language's standard screen");
strcpy(Demo_Menu_buf.M4,"I/O statements such as clrscr, cprint,");
strcpy(Demo_Menu_buf.M5,"scanf, ect. To resume right were you");
strcpy(Demo_Menu_buf.M6,"left off us S_REFRESHSCREEN and go on.");
PrevOption = 29;
}
}
s_changefieldcolor(Option-1,2,7,0);
s_changefieldcolor(PrevOption,2,7,0);
s_readkey();
s_changefieldcolor(Option-1,2,0,14);
s_changefieldcolor(PrevOption,2,0,14);
if (s_left) s_up = 1;
if (s_right) s_down = 1;
if ((isdigit(s_ch))&&(s_ch!='0'))
{
Option = s_ch-48;
}
if ((s_fkey)||(s_ch!=0))
{
if (s_enter)
{
if (Option==1)
{
RecordDemo();
s_loadscreen("Demo_Menu");
}
if (Option == 3)
{
initialize_Color_Demo_buf();
s_loadscreen("Color_Demo");
ChangeColors();
s_loadscreen("Demo_Menu");
}
if (Option == 4)
{
while (!s_esc) ProcessScreen();
s_loadscreen("Demo_Menu");
}
if (Option == 5)
{
strcpy(s_usermsg,
"Demo of S_READKEY - Press 'C' key to continue");
do{
s_readkey();
strcpy(s_usermsg,
"OOPS!! wrong key - Press 'C' key to continue");
} while ((s_ch!='C')&&(s_ch!='c'));
strcpy(s_usermsg," 'C' has been pressed - You may continue");
}
if (Option == 6)
{
for (X=1;X<7;X++){
gotoxy(39,14+X);
cprintf(" ");}
gotoxy(39,17);
cprintf(" << OKAY PRESS A SHIFT C to CONTINUE >>");
do{
s_nextkey();
s_ch = toupper(s_ch);
} while (!((s_shift)&&(s_ch=='C')));
}
if ((Option == 2)||(Option==7))
{
s_setcursor(S_NORMAL);
if (Option == 2)
Result = spawnl(P_WAIT,"DemoWind.exe","DemoWind.exe","/M",NULL);
else
Result = spawnl(P_WAIT,"DemoWind.exe","DemoWind.exe","/W",NULL);
s_setcursor(S_OFF);
if (Result == -1)
{
switch (errno)
{
case ENOENT:
{
strcpy(s_usermsg," 'DemoWind.Exe' not found! ");
break;
}
case ENOMEM:
{
strcpy(s_usermsg," Not enough memeory to run windows demo. ");
break;
}
}
}
else
strcpy(s_usermsg," End of Windows Demo ");
}
if (Option == 8)
{
Back_To_Turbo_C_Land();
s_refreshscreen();
}
s_showstatus = 1;
s_resetkeyflags();
}
}
else
strcpy(s_usermsg," Only UP and DOWN arrows and ENTER and ESC are valid");
}
while (!s_esc);
}
/*****************************
PROGRAM BEGINS HERE
*****************************/
void main()
{
delay(0);
ScrDemo_Init();
while (!s_esc) Read_Menu_Screen();
s_closescreenfile();
gotoxy(1,24);
cprintf("\n\r");
}